General information

Touhou Toolkit (or thtk for short) is a tool for unpacking and modifying Touhou game resource files. It allows to extract and modify game sprites, textures and GUI elements; in-game texts; level scripts that specify enemy movements, attacks, etc.; demo-replays and in-game sounds. It does not allow to work with music (except for midi music in games 6-8) and save files.

Touhou Toolkit consists of four console applications: thdat handles the main dat-files, thanm processes graphics, thmsg — dialogs, thecl — scripts. The current version completely supports all danmaku Touhou games from 6 to 13. thdat is also able to process dat-files for PC-98 games, but the resulting files (other than plain txt) are not processable by thtk.

Touhou Toolkit is a console application and this program provides a graphical user interface for it. First thing you should do is specify the path to your thtk folder. The latest version may be downloaded from a repository at Google Code. The archive also includes more detailed manuals for each of the applications.

THDAT

First stage of working with thtk is unpacking the main dat-file of the game. Choose the game in the main menu. Specify a target folder in the field "Folder". Specify the main dat-file (its name usually follows the pattern th№(e).dat. Files such as thbgm.dat and score.dat cannot be processed by thdat. Button functions:

All files contained in the dat-file will be placed in the target directory. Some of them, such as demo-replays, pictures and sounds, may be accessed directly. anm-, ecl- and msg-files should be further processed by thtk applications.

THANM

Files with .anm extension contain game graphics in PNG format, as well as scripts describing its behavior. Unpacking and packing process of these files are similar to dat-files, with two differences:

thanm also provides a method to replace a single picture within the archive without repacking. Specify a picture to replace in the «Entry» field (use the «...» button; you will need to generate a desription file first), then specify a replacement file in the «File» field and press «Replace file in archive».

THMSG

msg-files contain dialogues. Those files may be named *.msg (for newer games) or msg*.dat (for older ones). Each of them unpacks into a single txt file (encoded in Shift JIS for Japanese version and ASCII for English). «Extract archive to file» unpacks the specified «Archive» into the specified «File», and «Create archive from file» performs the opposite. The program automatically generates a suggested target file name matching the name of msg-file.

THECL

ecl-files contain scripts which describe the enemy movements, attacks, etc. Their structure and handling is analogous to msg-files. The thtk page on GoogleCode has an incomplete description of the script language used in these files.

ATTENTION! There is a known bug that affects creation of ecl-files. It causes the application to throw a syntax error and irreversably corrupts the target ecl-file. The bug is caused by the application improperly handling escaped double quotes (symbols \") which are used in spellcards' names. To fix this error you will need to replace all instances of \" in the source file to any symbol or combination of symbols (except for ").